import db from '@/utils/localstorage'
import { getLanguage } from '@/lang/index'

export default {
  namespaced: true,
  state: {
    theme_resolution: db.get('THEME_RESOLUTION', 'theme-default'),
    maploaded: db.get('MAP_LOADED', false),
    senceview: db.get('SENCE_VIEW', null),
    maptoken: db.get('MAP_TOKEN', ''),
    streeCode: db.get('STREET_CODE', ''),
    language: getLanguage()
  },
  mutations: {
    setTheme_Resolution: (state, theme_resolution) => {
      db.save('THEME_RESOLUTION', theme_resolution)
      state.theme_resolution = theme_resolution
    },
    setMap_Loaded: (state, maploaded) => {
      db.save('MAP_LOADED', maploaded)
      state.maploaded = maploaded
    },
    setSence_View: (state, senceview) => {
      db.save('SENCE_VIEW', senceview)
      state.senceview = senceview
    },
    setMapToken: (state, maptoken) => {
      db.save('MAP_TOKEN', maptoken)
      state.maptoken = maptoken
    },
    setStreet_code: (state, streecode) => {
      db.save('STREET_CODE', streecode)
      state.streeCode = streecode
    }
  }
}
